package com.example.sunlight.wzoneunicom;

import android.content.Context;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;

import java.util.ArrayList;
import java.util.List;

import static android.content.Context.WIFI_SERVICE;

/**
 * Created by SunLight on 2017/7/19.
 */

public class WifiStrength {
    private WifiManager wifiManager = null;//Wifi管理器  
    ArrayList<ScanResult> list;

    public List<String[]> Strength(Context context) {
        wifiManager = (WifiManager) context.getSystemService(WIFI_SERVICE);
        wifiManager.startScan();
        list = (ArrayList<ScanResult>) wifiManager.getScanResults();
        List<String[]> level = new ArrayList<>();
        for (int i = 0; i < list.size(); i++) {
            level.add(new String[]{list.get(i).level+"",list.get(i).SSID,list.get(i).BSSID});
        }

        return level;
    }
}
